﻿
var curVID; //当前选中的车辆ID
var curCardNo;
var curLicensePlate; //当前选中的车辆名称
var monitorLoaded = 0; //monitor.html是否加载完成
var monitortype = 2;//显示图形类型 2为2D图形 3为3D图形 默认为2D图形
var carTree;
var rightMenu;

var viewport;
Ext.BLANK_IMAGE_URL = "images/s.gif";

Ext.onReady(function() {
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    Ext.QuickTips.init();
    createRightMenu();

    viewport = new Ext.Viewport({
        layout: 'fit',
        items: [createMainPanel()],
        listeners: {
            "render": function(t) {
                if (Ext.isIE) {
                    window.attachEvent("onunload", unloadMap);
                    document.onkeydown = function() {
                        var type = event.srcElement.type;
                        var code = event.keyCode;
                        //删除code != 8 && 之后，修改密码时可以Backspace
                        //return ((code != 8 && code != 13) || (type == 'text' && code != 13) || (type == 'textarea') || (type == 'submit' && code == 13))
                        return ((code != 13) || (type == 'text' && code != 13) || (type == 'textarea') || (type == 'submit' && code == 13))
                    }
                } else {
                    document.addEventListener("onunload", unloadMap, false);
                }

                Ext.get('loading').fadeOut({
                    duration: .5,
                    remove: true
                });
                Ext.get('loading-mask').fadeOut({
                    duration: 1,
                    remove: true
                });
            }
        }
    });
    viewport.doLayout();
    //设置配置参数
    expandAllCar = true;
});

function createRightMenu() {
    rightMenu = new Ext.menu.Menu({
        id: 'rightClickCont',
        items: [
//            {
//                id: 'rmCmd1',
//                handler: returnPosition1,
//                text: '视频监控'
//            }, //2019.09.20 zx
//            {
//            id: 'rmCmd2',
//            handler: returnPosition2,
//            text: '温度历史'
//        }, //2019.09.20 zx
//            {
//            id: 'rmCmd3',
//            handler: returnPosition3,
//            text: '温度曲线'
//        }, //2019.09.20 zx
            {
                id: 'rmCmdTheCarVideo',
                handler: theCarVideo,
                text: '视频监控'
            },
            {
                id: 'rmCmdReturnPosition',
                handler: returnPosition,
                text: '立即回传'
            },
            {
                id: 'rmCmdReturnSetting',
                handler: returnSetting,
                text: '回传设置'
            },
            {
                id: 'rmCmdSpeedSetting',
                handler: speedSetting,
                text: '速度限制'
            },
			{
			    id: 'rmHistoryPlay',
			    handler: historyPlayOpen,
			    text: '轨迹回放'
			}
			/*, 2018.07.16 houruixian 设置电子围栏和取消电子围栏菜单项去掉
			{
			    id: 'rmSetRectangle',
			    handler: setupElectronicfence,
			    text: '设置围栏'
			}
			,
			{
			    id: 'rmcancelRectangle',
			    handler: cancelRectangle,
			    text: '取消围栏'
			}*/
		]
    });
}
function historyPlayOpen() {
    window.open('./html/HistoryPlayPage.aspx?id=' + curVID + '&name=' + curLicensePlate);
}